﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SharePointSearchBench.Library;

namespace SharePointSearchBench.UI.Controls
{
    /// <summary>
    /// Interaction logic for ContextInfo.xaml
    /// </summary>
    public partial class ContextInfo : UserControl
    {

        public ContextInfo()
        {
            InitializeComponent();
        }

        public ApiSource ApiSource
        {
            get 
            {
                if(this.webServiceButton.IsChecked.Equals(true))
                {
                    return ApiSource.Service;
                }
                return ApiSource.ObjectModel;
            }
        }

        public string ServiceUrl
        {
            get { return this.contextUrlComboBox.Text; }
        }

        public ICredentials GetCredentials()
        {

            NetworkCredential credentials = new NetworkCredential(this.usernameComboBox.Text, 
                this.passwordTextBox.Password, this.domainComboBox.Text);
            return credentials;
        }
       
    }
}
